Description:
IMCM checks that all of the overloaded constructors or methods that may be applicable to the same method or constuctor invocation have the same visibility.
Imagine that a client of class Printer is located in a different class
than Printer.
Then the allocation of Printer violates this rule, because
the second constructor is not visible at the point of the
allocation, but it still matches the allocation (based on
signature). Also, the call to print violates this
rule, because the second and third declarations of print are
not visible at the point of the call, but they still match
the call (based on the signature).
Incorrect:
Printer = class
public
constructor Create(queueSize:integer);overload;
procedure print(value:integer);overload;
strict private
constructor Create(id:char);overload;
procedure print(value:smallint);overload;
procedure print(value:char);overload;
end;
...
printer := Printer.Create('a');
printer.print('x');
Correct:
Printer = class
public
constructor Create(queueSize:integer);overload;
constructor Create(id:char);overload;
procedure print(value:integer);
strict private
procedure printNumber(value:smallint);overload;
procedure printNumber(value:char);overload;
end;